package com.hitrust.gs.lib.db;
/*
 * Created on 2006-10-9
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.sql.*;

import java.util.Map;
import com.hitrust.gs.lib.*;


public  class MyConnection implements java.sql.Connection
{
	
	  private java.sql.Connection mConn=null;
	  
	  public MyConnection(java.sql.Connection conn) 
	  {
	    mConn=conn; 
      }
	 
	  public Statement createStatement() throws SQLException 
	  {
		try
		{
			MyStatement stm = new MyStatement(mConn.createStatement());
			return stm;
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			throw e ;
		}
	  }
	  
	  public PreparedStatement prepareStatement(String sql) throws SQLException 
	  {
	  	try
	  	{
			SQLLogger.log(sql);
			MyPrepareStatement pst=new MyPrepareStatement(this,mConn.prepareStatement(sql));
			return pst;	
	  	}
	  	catch(SQLException e)
	  	{
	  		GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
	  		throw e ;
	  	}
	  }
	  public CallableStatement prepareCall(String sql) throws SQLException 
	  {
		try
		{
			SQLLogger.log(sql);
			return mConn.prepareCall(sql);
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}
	  }
	  public void close() throws SQLException 
	  {
	  	  mConn.close();
	  }
	  
	  public String nativeSQL(String sql) throws SQLException {
	   return mConn.nativeSQL(sql);
	  }

	  public void setAutoCommit(boolean autoCommit) throws SQLException {
	      mConn.setAutoCommit(autoCommit);
	 }
	  public boolean getAutoCommit() throws SQLException {
	    return mConn.getAutoCommit();
	  }
	  public void commit() throws SQLException 
	  {
		try
		{
			mConn.commit();
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			throw e ;
		}	  	
	   
	  }
	  public void rollback() throws SQLException {
	    mConn.rollback();
	  }

	  public boolean isClosed() throws SQLException {
	    return mConn.isClosed();
	  }
	  public DatabaseMetaData getMetaData() throws SQLException {
	    return mConn.getMetaData();
	  }
	  public void setReadOnly(boolean readOnly) throws SQLException {
	    mConn.setReadOnly(readOnly);
	  }
	  public boolean isReadOnly() throws SQLException {
	    return mConn.isReadOnly();
	  }
	  public void setCatalog(String catalog) throws SQLException {
	    mConn.setCatalog(catalog);
	  }
	  public String getCatalog() throws SQLException {
	    return mConn.getCatalog();
	  }
	  public void setTransactionIsolation(int level) throws SQLException {
	    mConn.setTransactionIsolation(level);
	  }
	  public int getTransactionIsolation() throws SQLException {
	    return mConn.getTransactionIsolation();
	  }
	  public SQLWarning getWarnings() throws SQLException {
	    return mConn.getWarnings();
	  }
	  public void clearWarnings() throws SQLException {
	    mConn.clearWarnings();
	  }
	  public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
		try
		{
			return new MyStatement(mConn.createStatement(resultSetType,resultSetConcurrency));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			throw e ;
		}	
	   
	  }

	  public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
	  	try
		{
			SQLLogger.log(sql);
			return new MyPrepareStatement(this,mConn.prepareStatement(sql,resultSetType ,resultSetConcurrency));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}	
	   
	  }

	  public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
	    
		try
		{
			SQLLogger.log(sql);
			return mConn.prepareCall(sql,resultSetType,resultSetConcurrency);
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}	
	  }

	  public Map getTypeMap() throws SQLException {
	    return mConn.getTypeMap();
	  }

	  public void setTypeMap(Map map) throws SQLException {
	    mConn.setTypeMap(map);
	  }

	  public void setHoldability(int holdability) throws SQLException {
	   mConn.setHoldability(holdability);
	  }

	  public int getHoldability() throws SQLException {
	    return mConn.getHoldability();
	  }
	  public Savepoint setSavepoint() throws SQLException {
	    return mConn.setSavepoint();
	  }

	  public Savepoint setSavepoint(String name) throws SQLException {
	    return mConn.setSavepoint(name);
	  }
	  public void rollback(Savepoint savepoint) throws SQLException {
	    mConn.rollback(savepoint);
	  }

	  public void releaseSavepoint(Savepoint savepoint) throws SQLException {
	    mConn.releaseSavepoint(savepoint);
	  }
	  public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
	    
		try
		{
			return new MyStatement(mConn.createStatement(resultSetType,resultSetConcurrency,resultSetHoldability));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			throw e ;
		}
	  }

	  public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
	    
		try
		{
			SQLLogger.log(sql);
			return new MyPrepareStatement(this,mConn.prepareStatement(sql,resultSetConcurrency,resultSetHoldability));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}
	  }

	  public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
	    
		try
		{
			SQLLogger.log(sql);
			return mConn.prepareCall(sql,resultSetConcurrency,resultSetHoldability);
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}
	  }
	  public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
	  	try
		{
			return new MyPrepareStatement(this,mConn.prepareStatement(sql,autoGeneratedKeys));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			throw e ;
		}
	  }
	  public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException 
	  {
		try
		{
			SQLLogger.log(sql);
			return new MyPrepareStatement(this,mConn.prepareStatement(sql,columnIndexes));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}
	   
	  }
	  public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException 
	  {
		try
		{
			SQLLogger.log(sql);
			return new MyPrepareStatement(this,mConn.prepareStatement(sql,columnNames));
		}
		catch(SQLException e)
		{
			GSBaseDAO.pushSQLError(e.toString());
			SQLLogger.log("error:"+e.toString());
			throw e ;
		}
	  }
	}


